package com.slz3.business.module.goodsManagement.gooTypeLevel2.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooTypeLevel2.domain.GooTypeLevel2;
import com.slz3.business.module.goodsManagement.gooTypeLevel2.domain.GooTypeLevel2Factory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooTypeLevel2TransactionalServiceImpl implements GooTypeLevel2TransactionalService {

    @Override
    public GooTypeLevel2 modify(GooTypeLevel2 gooTypeLevel2New) {
        Repositorys.gooTypeLevel2.test();
        Repositorys.gooTypeLevel2.save(GooTypeLevel2Factory.initBaseFields());
        System.err.println(1/0);
        gooTypeLevel2New.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooTypeLevel2.saveAndFlush(gooTypeLevel2New);
    }

    @Override
    public List<GooTypeLevel2> batchModify(List<GooTypeLevel2> gooTypeLevel2List) {
        return Repositorys.gooTypeLevel2.saveAll(gooTypeLevel2List);
    }
}
